<template>
  <div>
    <el-table :data="tableData" v-loading.body="loading" border style="width: 100%">
      <el-table-column prop="fileIdentifier" label="文件编号">
      </el-table-column>
      <el-table-column prop="fileName" label="文件名">
      </el-table-column>
      <el-table-column prop="fileCate" label="文件类型">
      </el-table-column>
      <el-table-column prop="applyCate" label="申请类型">
      </el-table-column>
      <el-table-column prop="applyDate" label="申请时间">
      </el-table-column>
      <el-table-column prop="applyStatus" label="申请状态">
      </el-table-column>
      <el-table-column label="操作">
        <template scope="scope">
          <el-button type="text" size="small" style="color:#fc5455" @click.native="del">删除</el-button>
          <el-button type="text" size="small">撤回</el-button>
          <el-button type="text" size="small">重新发起</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
  import {
    pagination,
    search,
    personal
  } from 'fac/mixin.js';
  import {
    mapGetters,
    mapMutations
  } from 'vuex'
  export default {
    name: 'apply',
    mixins: [pagination, search, personal],
    beforeRouteUpdate(to, from, next) {
      //当搜索字符串变化时,路由发生改变,重新请求数据
      console.log(to);
      console.log(this.search);
      // this.fetchData()
      next();
    },
    data() {
      return {
        loading: false,
        tableData: [{
          fileIdentifier: '4564723164611',
          fileName: '你好你好',
          fileCate: '公开1',
          applyCate: '',
          applyDate: '2017-5-8 12：12:12',
          applyStatus: '已审核'
        }]

      }
    },

    methods: {
      del() {
        this.$msgbox({
          message:'确认要删除吗',
          showCancelButton: true,
          confirmButtonText:'确定', 
          cancelButtonText: ' 取消'
          }).then(action=> {
            this.delInfo()
          })
      },

      //删除数据
      delInfo(){
        console.log(11)
      },

      //获取数据
      fetchData() {
        this.$http({
          url:this.api.GetDeptList
        }).then(data => {
            console.log(data)
        })
        console.log('正在获取数据,页码为:', this.currentPage);
      }
    },
    watch: {
      currentPage(newVal, oldVal) {
        console.log('老值:', oldVal);
        console.log('新值:', newVal);
        this.fetchData();
      }
    },
    mounted() {
      this.fetchData()
      this.isNotPersonalHomePage && this.renderPagination({
        total: 500,
        currentPage: 3
      });
    }
  }

</script>
